package org.lc.eic.messagingsystem.activemq;

import org.lc.eic.messagingsystem.MessagingReference;
import org.lc.eic.messagingsystem.OutgoingMessage;
import org.lc.eic.messagingsystem.exception.CreateOutgoingMessageException;

public class OutboundEndpoint implements
		org.lc.eic.messageendpoint.OutboundEndpoint {
	
	private MessagingReference messagingReference;

	public void setMessagingRef(MessagingReference messagingRef) {
		this.messagingReference = messagingRef;

	}
	
	public void send(byte[] messageData) throws Exception{
		OutgoingMessage outgoingMessage = this.messagingReference.createMessageToSend();
		
		outgoingMessage.getSendStream().write(messageData);
		
		this.messagingReference.sendMessage(outgoingMessage);
		
	}

}
